import asyncio

import edge_tts

class TTSModule:
    def __init__(self, config):
        self.voice = config.get("voice")

    async def text_to_speech(self,text,audio_path):
        speech=edge_tts.Communicate(text,self.voice)
        await speech.save(audio_path)
        return audio_path

if __name__ == '__main__':
    tts = TTSModule()
    file_path = asyncio.run(tts.text_to_speech("嗨呀!我来啦!准备好迎接我的调皮回答了吗?不管是关于哪个话题,我都会尽量让回答变得有趣和幽默,但同时也会尽力保证信息的准确性和有用性哦!有什么问题尽管问我吧","test1.wav"))